# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.pro>

_realname=pygit2
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=1.11.1
pkgrel=2
pkgdesc='Python bindings for libgit2 (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url='https://github.com/libgit2/pygit2'
license=('GPL2')
depends=("${MINGW_PACKAGE_PREFIX}-libgit2"
         "${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-cffi"
         "${MINGW_PACKAGE_PREFIX}-python-cached-property")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools"
             "${MINGW_PACKAGE_PREFIX}-cc")
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('793f583fd33620f0ac38376db0f57768ef2922b89b459e75b1ac440377eb64ec')

prepare() {
  cd "${srcdir}"
  rm -rf "python-build-${MSYSTEM}" | true
  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}"
}

build() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
    ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" -O1 --skip-build

  install -Dm644 COPYING "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}

# vim: ts=2 sw=2 et:
